<script setup>

</script>

<template>
  <div>
    <div style="margin-left: 50px;width: 100px;height: 100px;background-color: white;">
      <h3><b>基础信息</b></h3>
      <div class="carrierID">
        承运商编码:{{form.carrierID}}
      </div>

      <div class="companyName">
        公司名称:{{form.companyName}}
      </div>

      <div>
        承运商类型:{{form.carrierType}}
      </div>

      <div>
        营业执照号码:{{form.businessLicenseNumber}}
      </div>

      <div>
        税务登记号码:{{form.taxRegistrationNumber}}
      </div>

      <div>
        法人代表:{{form.legalRepresentative}}
      </div>

      <div>
        区域:{{form.region}}
      </div>

      <div>
        公司地址:{{form.companyAddress}}
      </div>

      <div>
        邮编:{{form.zipCode}}
      </div>

      <div>
        承运商状态:{{form.carrierStatus}}
      </div>

      <div>
        备注信息:{{form.remarks}}
      </div>










    </div>

    <div class="lian">
      <h2><b>联系人信息</b></h2>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="姓名" prop="contactName">
          <el-input v-model="form.contactName" placeholder="请输入姓名" />
        </el-form-item>

        <el-form-item label="手机号码" prop="phoneNumber">
          <el-input v-model="form.phoneNumber" placeholder="请输入手机号码" />
        </el-form-item>

        <el-form-item label="部门" prop="department">
          <el-input v-model="form.department" placeholder="请输入部门" />
        </el-form-item>

        <el-form-item label="职位" prop="position">
          <el-input v-model="form.position" placeholder="请输入职位" />
        </el-form-item>

        <el-form-item label="E-mail" prop="email">
          <el-input v-model="form.email" placeholder="请输入E-mail" />
        </el-form-item>

        <el-form-item label="QQ" prop="qq">
          <el-input v-model="form.qq" placeholder="请输入QQ" />
        </el-form-item>

      </el-form>

    </div>

    <div class="cai">
      <h2><b>财务信息</b></h2>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="发票抬头" prop="invoiceTitle">
          <el-input v-model="form.invoiceTitle" placeholder="请输入发票抬头" />
        </el-form-item>

        <el-form-item label="纳税人识别号" prop="taxpayerID">
          <el-input v-model="form.taxpayerID" placeholder="请输入纳税人识别号" />
        </el-form-item>

        <el-form-item label="开户行" prop="bankName">
          <el-input v-model="form.bankName" placeholder="请输入开户行" />
        </el-form-item>

        <el-form-item label="开户名称" prop="accountName">
          <el-input v-model="form.accountName" placeholder="请输入开户名称" />
        </el-form-item>

        <el-form-item label="银行账号" prop="bankAccount">
          <el-input v-model="form.bankAccount" placeholder="请输入银行账号" />
        </el-form-item>
      </el-form>
    </div>

    <div class="bao">
<!--      <el-button type="primary" @click="submitForm">保存</el-button>-->
      <el-button @click="cancel()">取消</el-button>

    </div>


  </div>


</template>
<style>



.cai{
  margin-left: 50px;
}

.lian{
  margin-left: 50px;
}


</style>

<script>
import {addCarriermangement, getCarriermangement, updateCarriermangement} from "@/api/carriermangement/carriermangement";


export default {
  data() {
    return {

      // 表单参数
      form: {},
      // 表单校验
      rules: {
        companyName: [
          { required: true, message: "公司名称不能为空", trigger: "blur" }
        ],

      }
    }
  },
  created() {
    // this.getList();
    console.log( this.$route.query.id+"....."+(this.$route.query.id!==undefined))
    if(this.$route.query.id!==undefined){
      this.findCarriermangement();
    }

  },
  methods: {

    cancel(){
      this.$router.push({ path: '/carriermanagementindex' })
    },


    findCarriermangement(){
      var id = this.$route.query.id;
      getCarriermangement(id).then(response => {
        this.form = response.data;
      });
    },

    /** 保存按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateCarriermangement(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              // this.open = false;
              // this.getList();
              this.$router.push({ path: '/carriermanagementindex' })
            });
          } else {
            addCarriermangement(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              // this.open = false;
              // this.getList();
              this.$router.push({ path: '/carriermanagementindex' })
            });
          }
        }
      });
    },
  }

}

</script>
